package com.dao.factory;

import com.dao.CustomerDao;
import com.dao.OrderDao;
import com.dao.ProductDao;
import com.dao.hibernate.factory.HibernateDaoFactory;
import com.dao.jdbc.factory.JdbcDaoFactory;
import com.dao.mybatis.factory.MyBatisDaoFactory;

/**
 * @author ${user}
 */
public abstract class DaoFactory {
    public enum FactoryType{
        JDBC,
        Hibernate,
        MyBatis;
    }

    public abstract CustomerDao getCustomerDao();
    public abstract ProductDao getProductDao();
    public abstract OrderDao getOrderDao();


    public static DaoFactory getDaoFactory(final FactoryType factoryType) {
        switch (factoryType) {
            case JDBC: {
                return new JdbcDaoFactory();
            }
            case Hibernate: {
                return new HibernateDaoFactory();
            }
            case MyBatis: {
                return new MyBatisDaoFactory();
            }
            default: {
                return null;
            }
        }
    }

}
